<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      (function () {
        /*
           matchAll检索全部
                */
        const regexp = /t(e)(st(\d?))/g;
        const str = 'test1test2';
        const array = [...str.matchAll(regexp)];
        console.log(array[0]);
        // expected output: Array ["test1", "e", "st1", "1"]
      })();
    </script>
  </body>
</html>
